part of native_dio_adapter;

class Result {
  NativeResponse? response;
  String? failure;

  Result({
    this.response,
    this.failure,
  });

  Result.decode(Map<String, dynamic> json) {
    if (json["response"] != null) {
      final map = json["response"].map((key, value) {
        return MapEntry(key.toString(), value);
      });
      response = NativeResponse.decode(Map<String, dynamic>.from(map));
    }
    if (json["failure"] != null) {
      failure = json["failure"];
    }
  }
}

class NativeResponse {
  dynamic data;
  Map<String, String>? headers;
  int? statusCode;
  String? statusMessage;

  NativeResponse({
    required this.data,
    this.headers,
    this.statusCode,
    this.statusMessage,
  });

  Map<String, dynamic> encode() {
    return {
      'data': data,
      'headers': headers,
      'statusCode': statusCode,
      'statusMessage': statusMessage,
    };
  }

  NativeResponse.decode(Map<String, dynamic> json) {
    data = json['data'];
    headers = json['headers'] == null
        ? null
        : Map<String, String>.from(json['headers']);
    statusCode = json['statusCode'];
    statusMessage = json['statusMessage'];
  }
}
